#ifndef WIDGET_H
#define WIDGET_H

#include "model/scene.h"

#include <QKeyEvent>
#include <QWidget>

class MainWindow;
class Projection;
class Filler;
class Scene;

class Widget : public QWidget {
    Q_OBJECT

protected:

    coord increment;
    Scene *scene;
    Projection *projection;
    Filler *shading;

    Point observer;
    Point focus;

    coord zoom;
    coord roll;

    virtual void keyPressEvent(QKeyEvent *e);
    virtual void paintEvent(QPaintEvent *);
    double toRadians(double angle);

public:
    explicit Widget(MainWindow *parent = 0);
    Object *object() const;

    Projection *getProjection();
    void setProjection(Projection *projection);

    Filler *getShading();
    void setShading(Filler *shading);

    void setObject(Object *object);
    void moveObserver(const coord x, const coord y, const coord z);
    void moveFocus(const coord x, const coord y, const coord z);
    void moveZoom(const coord z);
    void moveRoll(const coord ang);
    void moveVRP2P(const coord m);
    void moveP2VRP(const coord m);
    void moveViewAngle(const int x, const int y);
    void resetView();
    void updateSphereSize(const coord i);
    void changeSphereVisibility();

signals:

public slots:
    void onSceneChanged();
};

#endif // WIDGET_H

